package cn.edu.cug.cs.gtl.docsrv.img.querier;

import cn.edu.cug.cs.gtl.docsrv.img.block.ImageBlock;
import cn.edu.cug.cs.gtl.docsrv.img.manager.ImgManager;
import org.jetbrains.annotations.NotNull;
import org.locationtech.jts.geom.Geometry;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;

/**
 *
 */
public class DefaultBlockQuerier implements BlockQuerier{
    List<ImageBlock> blockList;
    ImgManager manager;

    public DefaultBlockQuerier(ImgManager imgManager){
        blockList = new ArrayList<>();
        this.manager=imgManager;
    }
    /**
     * Returns an iterator over elements of type {@code T}.
     *
     * @return an Iterator.
     */
    @NotNull
    @Override
    public Iterator<ImageBlock> iterator() {
        return blockList.iterator();
    }

    /**
     * Performs the given action for each element of the {@code Iterable}
     * until all elements have been processed or the action throws an
     * exception.  Unless otherwise specified by the implementing class,
     * actions are performed in the order of iteration (if an iteration order
     * is specified).  Exceptions thrown by the action are relayed to the
     * caller.
     *
     * @param action The action to be performed for each element
     * @throws NullPointerException if the specified action is null
     * @implSpec <p>The default implementation behaves as if:
     * <pre>{@code
     *     for (T t : this)
     *         action.accept(t);
     * }</pre>
     * @since 1.8
     */
    @Override
    public void forEach(Consumer<? super ImageBlock> action) {
        blockList.forEach(action);
    }

    /**
     * Creates a {@link Spliterator} over the elements described by this
     * {@code Iterable}.
     *
     * @return a {@code Spliterator} over the elements described by this
     * {@code Iterable}.
     * @implSpec The default implementation creates an
     * <em><a href="Spliterator.html#binding">early-binding</a></em>
     * spliterator from the iterable's {@code Iterator}.  The spliterator
     * inherits the <em>fail-fast</em> properties of the iterable's iterator.
     * @implNote The default implementation should usually be overridden.  The
     * spliterator returned by the default implementation has poor splitting
     * capabilities, is unsized, and does not report any spliterator
     * characteristics. Implementing classes can nearly always provide a
     * better implementation.
     * @since 1.8
     */
    @Override
    public Spliterator<ImageBlock> spliterator() {
        return blockList.spliterator();
    }


    @Override
    public boolean disjoint(Geometry g) {
        return false;
    }

    @Override
    public boolean touches(Geometry g) {
        return false;
    }

    @Override
    public boolean intersects(Geometry g) {
        return false;
    }

    @Override
    public boolean crosses(Geometry g) {
        return false;
    }

    @Override
    public boolean within(Geometry g) {
        return false;
    }

    @Override
    public boolean contains(Geometry g) {
        return false;
    }

    @Override
    public boolean overlaps(Geometry g) {
        return false;
    }

    @Override
    public boolean covers(Geometry g) {
        return false;
    }

    @Override
    public boolean coveredBy(Geometry g) {
        return false;
    }

    @Override
    public boolean equals(Geometry g) {
        return false;
    }
}
